var obj = {
    name: 'along',
    age: 32
}
// 数据劫持 
function observe(obj) {
    if (typeof obj === "object") {
        // 对象遍历用for in
        for (var key in obj) {
            defineReactive(obj, key, obj[key])
        }
    }

}
function defineReactive(obj, key, value) {
    Object.defineProperty(obj,key,{
        get(){
            console.log('get');
            return value
        },
        set(newVal){
            console.log('set');
            value=newVal
            
        }
    })
}
observe(obj)
console.log(obj);

   
